package com.workflow.workflowproject.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;

import java.io.Serial;

/**
 *  表定义层。
 *
 * @author Administrator
 * @since 2024-10-28
 */
public class FlowFormTableDef extends TableDef {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 
     */
    public static final FlowFormTableDef FLOW_FORM = new FlowFormTableDef();

    /**
     * 表单id
     */
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 是否存在
     */
    public final QueryColumn EXIST = new QueryColumn(this, "exist");
    /**
     * 版本id
     */
    public final QueryColumn FLOW_INFO_ID = new QueryColumn(this, "flow_info_id");
    /**
     * 版本id
     */
    public final QueryColumn VARSION_NAME = new QueryColumn(this, "version_name");

    /**
     * 创建时间
     */
    public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");

    /**
     * 移动端表单
     */
    public final QueryColumn MV_FORM_JSON = new QueryColumn(this, "mv_form_json");

    /**
     * PC端表单
     */
    public final QueryColumn PC_FORM_JSON = new QueryColumn(this, "pc_form_json");

    /**
     * 修改时间
     */
    public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, FLOW_INFO_ID,VARSION_NAME, MV_FORM_JSON, PC_FORM_JSON, CREATE_TIME, UPDATE_TIME, EXIST};

    public FlowFormTableDef() {
        super("", "t_com_flow_form");
    }

    private FlowFormTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public FlowFormTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new FlowFormTableDef("", "t_com_flow_form", alias));
    }

}
